package cn.iocoder.yudao.module.design.dal.mysql.designer;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.design.controller.admin.designer.vo.DesignerExportReqVO;
import cn.iocoder.yudao.module.design.controller.admin.designer.vo.DesignerPageReqVO;
import cn.iocoder.yudao.module.design.dal.dataobject.designer.DesignerDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 认证设计师 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface DesignerMapper extends BaseMapperX<DesignerDO> {

    default PageResult<DesignerDO> selectPage(DesignerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DesignerDO>()
                .eqIfPresent(DesignerDO::getUserId, reqVO.getUserId())
                .eqIfPresent(DesignerDO::getStyleCd, reqVO.getStyleCd())
                .eqIfPresent(DesignerDO::getRemark, reqVO.getRemark())
                .orderByDesc(DesignerDO::getId));
    }

    default List<DesignerDO> selectList(DesignerExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<DesignerDO>()
                .eqIfPresent(DesignerDO::getUserId, reqVO.getUserId())
                .eqIfPresent(DesignerDO::getStyleCd, reqVO.getStyleCd())
                .eqIfPresent(DesignerDO::getRemark, reqVO.getRemark())
                .orderByDesc(DesignerDO::getId));
    }

}
